<template>
	<view class="container">
		<view class="header">
			<text>选择单元</text>
			<!-- <view class="button" @click="skip">跳过</view> -->
		</view>
		<view class="city-info">
			<view class="current selected-city">
				{{params.projectName || ''}}-{{params.buildName || ''}}
			</view>
		</view>
		<view class="body">
			<view class="list">
				<view v-for="(item, index) in list" :key="index" @click="toPage(item)" class="list-item">
					<text>{{ item.u || '' }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import http from '@/common/request.js';
import { mapState } from 'vuex';
import { getCommonShareInfo } from '@/common/utils.js';
export default {
	onShareAppMessage() {
		return getCommonShareInfo();
	},
	onLoad(option) {
		this.params = JSON.parse(decodeURIComponent(option.params || '{}'));
	},
	data() {
		return {
			params: {},
		};
	},
	computed: {
		...mapState({ location: state => state.location, list: state => state.houseSetting.unitList })
	},
	methods: {
		toPage({u: unitName, rl}) {
			this.$store.dispatch('houseSetting/updateRoomList', rl);
			uni.navigateTo({
				url: './room?params=' + encodeURIComponent(JSON.stringify({...this.params, unitName})),
				animationDuration: 200,
				animationType: 'pop-in'
			})
		},
		skip(){
			uni.navigateBack({
				delta: 3,
				animationDuration: 200,
				animationType: 'pop-out'
			})
		}
	}
};
</script>

<style lang="less" scoped>
@import './house.less';
</style>
